const db=wx.cloud.database();
const userLove=db.collection("userLove");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    myLoveGoods:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      wx.cloud.callFunction({
        name:"searchMyLove"
      }).then(res=>{
        this.setData({ 
          myLoveGoods:res.result.data
        })
      })
  }, 
  onTapToDeatils:function(event){
    var goodname = event.currentTarget.dataset.goodname;
    var goodsId = event.currentTarget.dataset.id;
    var dbName = event.currentTarget.dataset.dbname;
    console.log(dbName)
    wx.navigateTo({
      url: '../../detail/detail?goodsId=' + goodsId +'&tapDBName='+dbName+'&goodname='+goodname
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    wx.cloud.callFunction({
      name:"searchMyLove"
    }).then(res=>{
      this.setData({ 
        myLoveGoods:res.result.data
      })
    })
  } 
})